﻿using NewsPortal.Modularity.Core;
using System.Web.Mvc;

namespace NewsPortal.Web.Infrastructure.Modularity.ModuleControllerFactory
{

    public class ModuleControllerFactory : IModuleControllerFactory
    {
        public Controller CreateController(IModule module)
        {
            Controller controller = (Controller)module;
            return controller;
        }

        public Controller CreateController(string moduleName)
        {
            Controller controller = null;
            try
            {
                controller = (Controller)GlobalModuleCollection.Get(moduleName);
            }
            catch
            {

            }
            return controller;
        }
    }

}